<template>
    <van-nav-bar
    title="搜索"
    left-text="返回"
    left-arrow
    @click-left="
      () => {
        $router.back('');
      }
    "
  />
  <van-search v-model="valuech" placeholder="请输入搜索关键词" @click="souc" />
  <template style="height: 100px;">
    <van-cell-group v-for="item in valdata">
      <van-cell :title="item.goods_name" value="内容" />
    </van-cell-group>
  </template>
</template>

<script setup>
let router = new useRouter();
import { ref, watch } from "vue";
import { coucApi } from "@/api/api";
let valch = ref("");
let valdata = ref([]);
import _ from "lodash";
import { useRouter } from "vue-router";
watch(
  valch,
  _.debounce((valch) => {
    coucApi(valch).then((res) => {
      console.log();
      valdata.value = res.data.message;
    });
  })
);
</script>

<style lang="scss" scoped>
</style>